TcaplusDB Client - Select Command (Query Global Indexes)
For TcaplusDB Client Instructions, see Document.
1. Function Descriptions
Query all qualified data according to the values of some global index fields specified by the user. It supports to query all field values or partial field values of the all data. If there are no matching records, an error will be returned.
Before querying a global index, the table must have been created with a global index. For the creation method, see Create Global Indexes.
Please note that the file name for saving query results cannot start with a number.
2. Initial Version
3.46.0
3. Command Syntax
select key1, key2, key3, value1, value2 [into result.csv] from table [where index_key1 = 1 and index_key2 = "abc"] [\P] [\G] [\S] [using tdr] [encode]
select * [into result.xml] from table [where index_key1 = 1 and index_key2 = "abc"] using tdr [\P];
Parameter description:
Parameter | PB Table | TDR Table | Required |
---|---|---|---|
table | Table name | Table name | Yes |
index_key | Index field name. You can specify the value of partial index fields | Index field name. You can specify the value of partial index fields | Yes |
key/value | field name | field name | At least one or * |
\P | Print delay data | Print delay data | No |
\G | Vertical printing | Vertical printing | No |
\S | Read data from copy | Read data from copy | No. If not specified, it is the default to read data from the primary replica |
\N | Do not print field names | Do not print field names | No. If not specified, it is the default to print field names |
\A | Append query results to a file | Append query results to a file | No. If not specified, it is the default to overwrite the query results to a file |
into | Export data to file | Export data to file | No |
using tdr | Do not support | If this parameter is required, it needs to specify the TDR file corresponding to the target table through the startup parameters at the time of starting the TcaplusDB Client. | No |
encode | Not supported (carriage return or invisible characters have been preprocessed) | After specifying this parameter, the dump command will encode the string type field value containing carriage return characters or invisible characters into BASE64 before outputting. Note: This parameter takes effect only when it is specified using tdr |
No |
4. Command Example
It is assumed that a global index has been created for the name and uname fields of the table. See Table Definition Example for table definition.
tcaplus> select * from test_table where name='testname' and uname='ab';
+------+------+----------+------+----+-----+
|gameid|itemid|name |typeid|Data|uname|
+------+------+----------+------+----+-----+
|1234 |12323 |"testname"|0 |9 |"ab" |
+------+------+----------+------+----+-----+
1 records selectd, select time: 9802 us
tcaplus> select uname from test_table where name='testname' and uname='ab';
+------+------+----------+-----+
|gameid|itemid|name |uname|
+------+------+----------+-----+
|1234 |12323 |"testname"|"ab" |
+------+------+----------+-----+
1 records selectd, select time: 9457 us
5. Common Errors
Refer to Common Errors.
6. Related Documents
[TDR Generic Table][C++ SDK] Interface Description for Querying Global Index.
[TDR Generic Table][Go SDK] Interface Description for Querying Global Index.
[PB Generic Table][C++ SDK] Interface Description for Querying Global Index.
[PB Generic Table][Go SDK] Interface Description for Querying Global Index.
[PB Generic Table][RESTFul API] Interface Description for Querying Global Index.